//
//  PMTabBarController.m
//
//  Created by Evan on 05/12/2016.
//  Copyright © 2016 Evan. All rights reserved.
//

#import "PMTabBarController.h"
#import "PMNavigationController.h"
#import "MeViewController.h"
#import "HomePageViewController.h"
#import "CommonData.h"
@interface PMTabBarController ()

@end
@implementation PMTabBarController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.tabBar setTintColor:[UIColor grayColor]];
    
    //设置tab的背景色
//    UIView *viewBtab = [[UIView alloc]init];
//    viewBtab.backgroundColor = [UIColor whiteColor];
//    viewBtab.frame = self.tabBar.bounds;
//    [self.tabBar insertSubview:viewBtab atIndex:0];
    
    
    HomePageViewController* c1 = [[HomePageViewController alloc]init];
    c1.tabBarItem.title=@"首页";
    c1.tabBarItem.image=[UIImage imageNamed:@"tab1n"];
    c1.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [c1.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:COLOR_tabBarRed,NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    PMNavigationController* navi1 = [[PMNavigationController alloc] initWithRootViewController:c1];
//    [self navigationInit:navi1];
    
    MeViewController *c2=[[MeViewController alloc]init];
    c2.tabBarItem.title=@"我";
    PMNavigationController* navi2 = [[PMNavigationController alloc] initWithRootViewController:c2];
    c2.tabBarItem.image=[UIImage imageNamed:@"tab1n"];
    c2.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [c2.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:COLOR_tabBarRed,NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
//    [self navigationInit:navi2];
    
    HomePageViewController* c3 = [[HomePageViewController alloc]init];
    c3.tabBarItem.title=@"首页";
    c3.tabBarItem.image=[UIImage imageNamed:@"tab1n"];
    c3.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [c3.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:COLOR_tabBarRed,NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    PMNavigationController* navi3 = [[PMNavigationController alloc] initWithRootViewController:c3];
//    [self navigationInit:navi3];
    
    MeViewController *c4=[[MeViewController alloc]init];
    c4.tabBarItem.title=@"我";
    c4.tabBarItem.image=[UIImage imageNamed:@"tab1n"];
    c4.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab1"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [c4.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:COLOR_tabBarRed,NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
    
    PMNavigationController* navi4 = [[PMNavigationController alloc] initWithRootViewController:c4];
//    [self navigationInit:navi4];
    
    self.viewControllers=@[navi1,navi2,navi3,navi4];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}

- (void)navigationInit:(PMNavigationController *)navi{
    navi.navigationBar.barTintColor =  [UIColor colorWithRed:144/255.0 green:144/255.0 blue:144/255.0 alpha:1];
    [navi.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor], NSForegroundColorAttributeName, nil]];
}

- (void)tabBarInit:(PMViewController *)navi{
   
}




@end
